package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.apis.admin.SensitiveControllerApi;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author Jt
 * @date 2021/4/10 22:29
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements SensitiveControllerApi {

    @Resource
    private AdSensitiveService adSensitiveService;

    /**
     * 查询敏感词
     * @param sensitiveDto
     * @return
     */
    @PostMapping("/list")
    @Override
    public ResponseResult list(@RequestBody SensitiveDto sensitiveDto) {
        return adSensitiveService.list(sensitiveDto);
    }

    /**
     * 新增敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/save")
    @Override
    public ResponseResult insert(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }

    @DeleteMapping("/del/{id}")
    @Override
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return adSensitiveService.delete(id);
    }
}
